<template>
<view>
<view class="bottom_border">
    <view class="bottom_border_title">认证店铺</view>
    <view @tap="changeenter" class="bottom_border_title_view" :data-classid="detail.id">
        <view class="bottom_border_title_view_index">{{detail.cycle}}天</view>
        <view class="bottom_border_title_view_index">{{detail.price}}元</view>
        <view class="bottom_border_title_view_last">
            <image class="bottom_border_title_view_last_img" src="/static/pages/image/xuanze_btn.png"></image>
        </view>
    </view>
    <form @submit="gopay" reportSubmit="true">
        <button class="bottom_border_btn" form-type="submit">确认支付</button>
    </form>
</view>
<view class="jieshao_border">
    <view class="jieshao_view">1.认证店铺发布车辆信息免费</view>
    <view class="jieshao_view">2.认证店铺尊享vip店铺页面</view>
    <view class="jieshao_view">3.认证店铺可自定义店铺封面及店铺logo</view>
</view>
</view>
</template>

<script>
var app = getApp();

export default {
  data() {
    return {
      detail: ""
    };
  },

  components: {},
  props: {},
  onLoad: function (a) {
    var t = this;
    app.globalData.util.request({
      url: "entry/wxapp/Api",
      data: {
        m: "monai_market",
        r: "store.getVip"
      },
      success: function (a) {
        t.setData({
          detail: a.data.data
        });
      }
    });
  },
  methods: {
    gopay: function (t) {
      console.log(t.detail.formId), app.globalData.util.request({
        url: "entry/wxapp/Payvip",
        data: {
          m: "monai_market",
          uid: wx.getStorageSync("uid")
        },
        success: function (a) {
          1 != a.data.data ? a.data && a.data.data && !a.data.errno && wx.requestPayment({
            timeStamp: a.data.data.timeStamp,
            nonceStr: a.data.data.nonceStr,
            package: a.data.data.package,
            signType: "MD5",
            paySign: a.data.data.paySign,
            success: function (a) {
              wx.showModal({
                title: "提示",
                content: "支付成功",
                showCancel: !1,
                success: function (a) {
                  app.globalData.util.request({
                    url: "entry/wxapp/Api",
                    data: {
                      m: "monai_market",
                      r: "store.send_tel_news",
                      formid: t.detail.formId,
                      uid: wx.getStorageSync("uid"),
                      tel_type: 2
                    }
                  }), a.confirm && wx.reLaunch({
                    url: "/pages/mine/index"
                  });
                }
              });
            },
            fail: function (a) {
              wx.showToast({
                title: "支付失败",
                icon: "none",
                duration: 2e3
              });
            }
          }) : wx.showModal({
            title: "提示",
            content: "支付成功",
            showCancel: !1,
            success: function (a) {
              a.confirm && wx.reLaunch({
                url: "/pages/mine/index"
              }), app.globalData.util.request({
                url: "entry/wxapp/Api",
                data: {
                  m: "monai_market",
                  r: "store.send_tel_news",
                  formid: t.detail.formId,
                  uid: wx.getStorageSync("uid"),
                  tel_type: 2
                }
              });
            }
          });
        }
      });
    },

    changeenter() {
      console.log("占位：函数 changeenter 未声明");
    }

  }
};
</script>
<style>
@import "./enter.css";
</style>